package Packge;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ws
 * Date: 2022-11-26
 * Time: 23:12
 */
//public class Test2 {
//    public static void main(String[] args) {
//        Use use = new Use();
//        Scanner scanner = new Scanner(System.in);
//        System.out.println("请输入用户名：");
//        String a = scanner.nextLine();
//        System.out.println("请输入密码：");
//        String b = scanner.nextLine();
//        if (use.cmp(a, b)) {
//            System.out.println("密码正确");
//        }else {
//            System.out.println("密码错误");
//        }
//    }
//}
public class Test2{
    public static String name = "Admin";
    public static String password = "admin";
    public static void login (String name, String passWord) throws PassWordException, NameException{
        if (Test2.name.compareTo(name) != 0){
            throw new NameException("用户名错误");
        }else if (Test2.password.compareTo(passWord) != 0){
            throw new PassWordException("密码错误");
        }
    }

    public static void main(String[] args) throws PassWordException, NameException{
        Scanner scanner = new Scanner(System.in);
         System.out.println("请输入用户名：");
        String a = scanner.nextLine();
        System.out.println("请输入密码：");
        String b = scanner.nextLine();
        login(a,b);
    }
}